<?php $weekdays = array('Chủ nhật', 'Hai', 'Ba', 'Tư', 'Năm', 'Sáu', 'Bảy');?>
<section id="content">
<script>
function backToAdd(){
	$("#main_form").prop("action", "schedule_add");
	return $("#main_form").submit();
}

function backToEdit(){
	$("#main_form").prop("action", "schedule_edit");
	return $("#main_form").submit();
}

</script>

<form id="main_form" method="post" action="scheduleRegist">
<?php if (isset($scheduleId)){
	echo '<input type="hidden" name="scheduleId" value="'.$scheduleId.'"/>';
} ?>
	
	<input type="hidden" name="subjectId" value="<?php echo $subjectId?>">
	<input type="hidden" name="weekDay" value="<?php echo $weekDay; ?>">
	<input type="hidden" name="startHour" value="<?php echo $startHour; ?>">
	<input type="hidden" name="endHour" value="<?php echo $endHour; ?>">
	<input type="hidden" name="startMin" value="<?php echo $startMin; ?>">
	<input type="hidden" name="endMin" value="<?php echo $endMin; ?>">
<?php if(isset($scheduleId)){ ?>
	<center><H2>Cập nhật thời khóa biểu</H2></center>
<?php } else { ?>
	<center><H2>Thêm thời khóa biểu</H2></center>
<?php } ?>

<table id="edit_table">
<tr>
	<td class="edit_column" width="170">
		Ngày trong tuần
	</td>
	<td style="text-align: left;">
		<?php echo $weekdays[$weekDay];?>
	</td>
</tr>
<tr>
	<td class="edit_column">
		Thời gian bắt đầu
	</td>
	<td style="text-align: left;">
		<?php echo $startHour;?> giờ <?php echo $startMin;?> phút
	</td>
</tr>
<tr>
	<td class="edit_column">
		Thời gian kết thúc
	</td>
	<td style="text-align: left;">
		<?php echo $endHour;?> giờ <?php echo $endMin;?> phút
	</td>
</tr>
<tr>
	<td colspan="2" style="text-align: center;">
		<button type="submit">Hoàn tất</button>
   		<button type="button" onclick="<?php echo (isset($scheduleId)) ? "backToEdit()" : "backToAdd()";?>">Quay Lại</button>
	</td>
</tr>
</table>
</form>
</section>
	

				

				